﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace weiqijiance.国标自检类
{
    public class JDhelpClass
    {
        /// <summary>
        /// 计算自检-滑行测试
        /// </summary>
        /// <param name="fdiw"></param>
        /// <param name="fcsd"></param>
        /// <param name="fjssd"></param>
        /// <param name="fgonglv"></param>
        /// <param name="fnz"></param>
        /// <returns></returns>
        public static double jdhxsj(double fdiw, double fcsd, double fjssd, double fgonglv, double fnz)
        {
            try
            {
                double ccdt = fdiw * ((fcsd * fcsd / 3.6 / 3.6) - (fjssd * fjssd / 3.6 / 3.6)) / (2000 * (fgonglv + fnz));
                return ccdt;
            }
            catch (Exception)
            {
                return 0;
            }
        }
        /// <summary>
        /// 计算自检-附加损失测试
        /// </summary>
        /// <param name="fdiw"></param>
        /// <param name="fcsd"></param>
        /// <param name="fjssd"></param>
        /// <param name="facdt"></param>
        /// <returns></returns>
        public static double jdfjssgl(double fdiw, double fcsd, double fjssd, double facdt)
        {
            try
            {
                double plhp = fdiw * ((fcsd * fcsd / 3.6 / 3.6) - (fjssd * fjssd / 3.6 / 3.6)) / (2000 * facdt);
                return plhp;
            }
            catch (Exception )
            {
                return 0;
            }
        }

        public static double DateDiff(DateTime DateTime1, DateTime DateTime2)
        {
            double dateDiff = 0;
            TimeSpan ts = DateTime1.Subtract(DateTime2).Duration();
            dateDiff = ts.Days * 60 * 60 * 60 * 1000 + ts.Hours * 60 * 60 * 1000 + ts.Minutes * 60 * 1000 + ts.Seconds * 1000 + ts.Milliseconds;
            return dateDiff;
        }
    }
}
